home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / dvtools / examples / windows / dv_ocx / dvocxppg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-08  |  3.0 KB  |  101 lines

  1. // DvocxPpg.cpp : Implementation of the CDvocxPropPage property page class.
  2.  
  3. #include "stdafx.h"
  4. #include "dvocx.h"
  5. #include "DvocxPpg.h"
  6.  
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13.  
  14. IMPLEMENT_DYNCREATE(CDvocxPropPage, COlePropertyPage)
  15.  
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // Message map
  19.  
  20. BEGIN_MESSAGE_MAP(CDvocxPropPage, COlePropertyPage)
  21.     //{{AFX_MSG_MAP(CDvocxPropPage)
  22.     ON_BN_CLICKED(IDC_FILES, OnFiles)
  23.     //}}AFX_MSG_MAP
  24. END_MESSAGE_MAP()
  25.  
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Initialize class factory and guid
  29.  
  30. IMPLEMENT_OLECREATE_EX(CDvocxPropPage, "DVOCX.DvocxPropPage.1",
  31.     0xf1e0ab14, 0xa1af, 0x11cf, 0xa7, 0x5e, 0x20, 0x4c, 0x4f, 0x4f, 0x50, 0x20)
  32.  
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CDvocxPropPage::CDvocxPropPageFactory::UpdateRegistry -
  36. // Adds or removes system registry entries for CDvocxPropPage
  37.  
  38. BOOL CDvocxPropPage::CDvocxPropPageFactory::UpdateRegistry(BOOL bRegister)
  39. {
  40.     if (bRegister)
  41.         return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
  42.             m_clsid, IDS_DVOCX_PPG);
  43.     else
  44.         return AfxOleUnregisterClass(m_clsid, NULL);
  45. }
  46.  
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDvocxPropPage::CDvocxPropPage - Constructor
  50.  
  51. CDvocxPropPage::CDvocxPropPage() :
  52.     COlePropertyPage(IDD, IDS_DVOCX_PPG_CAPTION)
  53. {
  54.     //{{AFX_DATA_INIT(CDvocxPropPage)
  55.     m_fUseDblBuf = FALSE;
  56.     m_viewFile = _T("");
  57.     m_updateRate = 0;
  58.     m_autoUpdate = FALSE;
  59.     m_scale = 0.0;
  60.     //}}AFX_DATA_INIT
  61. }
  62.  
  63.  
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CDvocxPropPage::DoDataExchange - Moves data between page and properties
  66.  
  67. void CDvocxPropPage::DoDataExchange(CDataExchange* pDX)
  68. {
  69.     //{{AFX_DATA_MAP(CDvocxPropPage)
  70.     DDP_Check(pDX, IDC_DBL_BUF, m_fUseDblBuf, _T("UseDoubleBuffering") );
  71.     DDX_Check(pDX, IDC_DBL_BUF, m_fUseDblBuf);
  72.     DDP_Text(pDX, IDC_VIEW_FILE, m_viewFile, _T("ViewFile") );
  73.     DDX_Text(pDX, IDC_VIEW_FILE, m_viewFile);
  74.     DDP_Text(pDX, IDC_UPDATE_RATE, m_updateRate, _T("UpdateRate") );
  75.     DDX_Text(pDX, IDC_UPDATE_RATE, m_updateRate);
  76.     DDP_Check(pDX, IDC_UPDATE, m_autoUpdate, _T("AutoUpdate") );
  77.     DDX_Check(pDX, IDC_UPDATE, m_autoUpdate);
  78.     DDP_Text(pDX, IDC_SCALE, m_scale, _T("Scale") );
  79.     DDX_Text(pDX, IDC_SCALE, m_scale);
  80.     //}}AFX_DATA_MAP
  81.     DDP_PostProcessing(pDX);
  82. }
  83.  
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CDvocxPropPage message handlers
  87.  
  88. void CDvocxPropPage::OnFiles() 
  89. {
  90.     CFileDialog dlg(TRUE);
  91.     char * szFilter = "View Files (*.v)\0*.v\0 Sub-drawings (*.sd)\0 *.sd\0 Layout files (*.lay)\0 *.lay\0All Files (*.*)\0 *.*\0";
  92.  
  93.     dlg.m_ofn.lpstrFilter = szFilter;
  94.     dlg.m_ofn.nFilterIndex = 1;
  95.     dlg.m_ofn.lpstrTitle = "Load DataViews View File";
  96.     if (dlg.DoModal() == IDCANCEL)
  97.         return;
  98.     
  99.     SetDlgItemText(IDC_VIEW_FILE, dlg.GetPathName());
  100. }
  101.